package com.oocl.customersystem.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class LoginFilter implements Filter {

    
    public LoginFilter() {
    }

	public void destroy() {
	}

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//		HttpServletRequest req = (HttpServletRequest)request;
//		HttpServletResponse rep = (HttpServletResponse)response;
//		
//			String requestUri = req.getRequestURI();
//            String contextPath = req.getContextPath();
//	        String url = requestUri.substring(contextPath.length());
//			if("/login.jsp".equals(url)||"/login".equals(url)
//					||"/register.jsp".equals(url)||
//					"/regist".equals(url)||"/logo.png".equals(url)
////					||"/updatemuser".equals(url)||
////					"/updatefroma".equals(url)||
////					"/muser2c".equals(url)||
////					"/foodlist2c".equals(url)||
////					"/muserslist2C".equals(url)||
////					"/reg.css".equals(url)
//					){
//				chain.doFilter(request, response);
//			}else{
//				if(req.getSession().getAttribute("cname")!=null){
//					chain.doFilter(request, response);
//				}else{
//					rep.sendRedirect("login.jsp");
//				}
//			}
		
		chain.doFilter(request, response);
	}

	
	public void init(FilterConfig fConfig) throws ServletException {
		
	}

}
